<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="userUrl" value="${pageContext.request.contextPath}/user" scope="application"/>
<c:set var="base" value="${pageContext.request.contextPath}" scope="application"/>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Signin Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="${userUrl}css/bootstrap.min.css" rel="stylesheet">


    <!-- Custom styles for this template -->
    <link href="signin.css" rel="stylesheet">


</head>

<body>

<div class="container">
    <a href="${base}/front/FindTable.jsp">餐厅</a>

    <form class="form-signin" action="../user" method="post">
        <input type="hidden" name="method" value="userLogin"/>
        <h2 class="form-signin-heading">登陆</h2>
        <label for="inputEmail" class="sr-only">用户名</label>
        <input type="text" id="inputEmail" class="form-control" placeholder="用户名" name="userName" required autofocus>
        <label for="inputPassword" class="sr-only">密码</label>
        <input type="password" id="inputPassword" class="form-control" placeholder="密码" name="userPassword" required>
        <label for="inputEmail" class="sr-only">验证码</label>
        <div>
            <div style="float:left;margin-bottom: 10px">
                <input type="text" class="form-control" style="width: 170px" placeholder="验证码" name="validate" required
                       autofocus>
            </div>
            <div style="float:left; margin-left: 10px;margin-top: 7px">
                <label for="inputEmail" class="sr-only">验证码</label>
                <img id="img1" src="${base}/validatecode" alt="验证码" height="30px" onclick="changeCode(this)">
            </div>
        </div>

        <button class="btn btn-lg btn-primary btn-block" type="submit">登陆</button>
        <center>
            <a href="registere.jsp">注册</a>
        </center>
    </form>


</div> <!-- /container -->


</body>
<script>
    /**
     * 更换验证码
     * @param obj
     */
    function changeCode(obj) {
        obj.src = "${base}/validatecode?time=" + new Date().getTime();
    }

</script>
</html>
